﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGsRenderEnvironmentProperties : OdGsProperties
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGsRenderEnvironmentProperties(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGsRenderEnvironmentProperties_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGsRenderEnvironmentProperties obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGsRenderEnvironmentProperties()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGsRenderEnvironmentProperties(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdGsRenderEnvironmentProperties cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGsRenderEnvironmentProperties_cast(OdRxObject.getCPtr(pObj));
			OdGsRenderEnvironmentProperties result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGsRenderEnvironmentProperties)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGsRenderEnvironmentProperties)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGsRenderEnvironmentProperties)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGsRenderEnvironmentProperties_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGsRenderEnvironmentProperties_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGsRenderEnvironmentProperties_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdGsRenderEnvironmentProperties createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGsRenderEnvironmentProperties_createObject();
			OdGsRenderEnvironmentProperties result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGsRenderEnvironmentProperties)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGsRenderEnvironmentProperties)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGsRenderEnvironmentProperties)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGiRenderEnvironmentTraitsData renderEnvironmentTraitsData()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGsRenderEnvironmentProperties_renderEnvironmentTraitsData(this.swigCPtr);
			OdGiRenderEnvironmentTraitsData result = (intPtr == IntPtr.Zero) ? null : new OdGiRenderEnvironmentTraitsData(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isTraitsModified()
		{
			bool result = GlobalsPINVOKE.OdGsRenderEnvironmentProperties_isTraitsModified(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void clearTraits()
		{
			GlobalsPINVOKE.OdGsRenderEnvironmentProperties_clearTraits(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdGsProperties.PropertiesType propertiesType()
		{
			OdGsProperties.PropertiesType result = (OdGsProperties.PropertiesType)GlobalsPINVOKE.OdGsRenderEnvironmentProperties_propertiesType(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdGsProperties propertiesForType(OdGsProperties.PropertiesType type)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGsRenderEnvironmentProperties_propertiesForType(this.swigCPtr, (int)type);
			OdGsProperties result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGsProperties)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGsProperties)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGsProperties)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void update(OdGiDrawable pUnderlyingDrawable, OdGsViewImpl view, uint incFlags)
		{
			GlobalsPINVOKE.OdGsRenderEnvironmentProperties_update__SWIG_0(this.swigCPtr, OdGiDrawable.getCPtr(pUnderlyingDrawable), OdGsViewImpl.getCPtr(view), incFlags);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual void update(OdGiDrawable pUnderlyingDrawable, OdGsViewImpl view)
		{
			GlobalsPINVOKE.OdGsRenderEnvironmentProperties_update__SWIG_1(this.swigCPtr, OdGiDrawable.getCPtr(pUnderlyingDrawable), OdGsViewImpl.getCPtr(view));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual void display(OdGsBaseVectorizer view, OdGsPropertiesDirectRenderOutput pdro, uint incFlags)
		{
			GlobalsPINVOKE.OdGsRenderEnvironmentProperties_display__SWIG_0(this.swigCPtr, OdGsBaseVectorizer.getCPtr(view), OdGsPropertiesDirectRenderOutput.getCPtr(pdro), incFlags);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual void display(OdGsBaseVectorizer view, OdGsPropertiesDirectRenderOutput pdro)
		{
			GlobalsPINVOKE.OdGsRenderEnvironmentProperties_display__SWIG_1(this.swigCPtr, OdGsBaseVectorizer.getCPtr(view), OdGsPropertiesDirectRenderOutput.getCPtr(pdro));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual void display(OdGsBaseVectorizer view)
		{
			GlobalsPINVOKE.OdGsRenderEnvironmentProperties_display__SWIG_2(this.swigCPtr, OdGsBaseVectorizer.getCPtr(view));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
